package com.lst.api.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lst.api.constant.OrderStatusEnum;
import com.lst.tools.mybatis.entity.DeleteBaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;


/**
 * 订单表
 *
 * @author Frank
 * @date 2020-02-05 23:28:25
 * @version: V1.0
 */
@Data
@NoArgsConstructor
@TableName(value = "lst_order")
@ApiModel(value = "订单表")
public class Order extends DeleteBaseModel {

    public static final String APPLY_NO = "apply_no";
    public static final String PROMO_USER_ID = "promo_user_id";
    public static final String PRODUCT_ID = "product_id";
    public static final String LOAN_QUOTA = "loan_quota";
    public static final String LOAN_YEARS = "loan_years";
    public static final String LOAN_RATE = "loan_rate";
    public static final String ORDER_STATUS = "order_status";
    public static final String LOAN_LAST_FOLLOW_AT = "loan_last_follow_at";
    public static final String LOAN_SUBMIT_AT = "loan_submit_at";
    public static final String LOAN_APPLY_AT = "loan_apply_at";
    public static final String LOAN_SUCCESS_AT = "loan_success_at";
    public static final String LOAN_FAIL_AT = "loan_fail_at";

    @ApiModelProperty(name = "applyNo", value = "申请编号", dataType = "String")
    @TableField(value = APPLY_NO)
    private String applyNo;     

    @ApiModelProperty(name = "promoUserId", value = "推销员用户id", dataType = "Long")
    @TableField(value = PROMO_USER_ID)
    private Long promoUserId;

    @ApiModelProperty(name = "productId", value = "产品id", dataType = "Long")
    @TableField(value = PRODUCT_ID)
    private Long productId;

    @ApiModelProperty(name = "loanQuota", value = "贷款额度，单位元", dataType = "Double")
    @TableField(value = LOAN_QUOTA)
    private Double loanQuota;

    @ApiModelProperty(name = "loanYears", value = "贷款年限，单位年", dataType = "Integer")
    @TableField(value = LOAN_YEARS)
    private Integer loanYears;

    @ApiModelProperty(name = "loanRate", value = "贷款利率，单位%", dataType = "Double")
    @TableField(value = LOAN_RATE)
    private Double loanRate;

    @ApiModelProperty(name = "orderStatus", value = "订单状态  10:订单已提交   20:贷款申请中   30:贷款成功   40:贷款失败", dataType = "Integer")
    @TableField(value = ORDER_STATUS)
    private Integer orderStatus;

    @ApiModelProperty(name = "loanLastFollowAt", value = "最后跟进时间", dataType = "Date")
    @TableField(value = LOAN_LAST_FOLLOW_AT)
    private Date loanLastFollowAt;

    @ApiModelProperty(name = "loanSubmitAt", value = "贷款提交时间", dataType = "Date")
    @TableField(value = LOAN_SUBMIT_AT)
    private Date loanSubmitAt;

    @ApiModelProperty(name = "loanApplyAt", value = "贷款申请时间", dataType = "Date")
    @TableField(value = LOAN_APPLY_AT)
    private Date loanApplyAt;

    @ApiModelProperty(name = "loanSuccessAt", value = "贷款成功时间", dataType = "Date")
    @TableField(value = LOAN_SUCCESS_AT)
    private Date loanSuccessAt;

    @ApiModelProperty(name = "loanFailAt", value = "贷款失败时间", dataType = "Date")
    @TableField(value = LOAN_FAIL_AT)
    private Date loanFailAt;
    
	public Order(OrderContract ocItem) {
		if (ocItem == null) {
            return;
        }
		this.applyNo = ocItem.getApplyNo();
		this.promoUserId = ocItem.getPromoUserId();
		this.productId = ocItem.getProductId();
		this.orderStatus = OrderStatusEnum.ORDER_SUBMITTED.getKey();
	}
    
}